--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Commit a7b0f9924ea137bc50afcd85b8d939ad15385394
Parents : a1d35b3
Author : Mark Qvist <bc7291552be7a58f361522990465165c>
Date : 2026-04-26T01:18:31+02:00
Track local ref SHAs on pull for incremental bundle generation on remote
Changes
2 files changed, 21 insertions(+), 2 deletions(-)
Diff
diff --git a/RNS/Utilities/rngit/client.py b/RNS/Utilities/rngit/client.py
index 28220fe4..b807b295 100644
--- a/RNS/Utilities/rngit/client.py
+++ b/RNS/Utilities/rngit/client.py
@@ -433,7 +433,21 @@ class ReticulumGitClient():
batch = fetch_queue[:ref_batch_size]
fetch_queue = fetch_queue[ref_batch_size:]
- refs_list = [{"sha": sha, "ref": ref} for sha, ref in batch]
+ refs_list = []
+ for sha, ref in batch:
+ ref_entry = {"sha": sha, "ref": ref}
+ try:
+ # Attempt to get local ref SHA for incremental bundle generation on remote
+ result = subprocess.run(["git", "rev-parse", ref], capture_output=True, text=True, check=False)
+ if result.returncode == 0:
+ local_sha = result.stdout.strip()
+ if local_sha != sha: ref_entry["have"] = local_sha
+
+ except Exception as e:
+ RNS.log(f"Could not resolve local SHA for {ref} during fetch enumeration, getting full history for this ref: {e}", RNS.LOG_WARNING)
+
+ refs_list.append(ref_entry)
+
ref_names = [ref for _, ref in batch]
RNS.log(f"Fetching batch of {len(refs_list)} refs: {ref_names}", RNS.LOG_DEBUG)
diff --git a/RNS/Utilities/rngit/server.py b/RNS/Utilities/rngit/server.py
index 3a41060b..88b91cfa 100644
--- a/RNS/Utilities/rngit/server.py
+++ b/RNS/Utilities/rngit/server.py
@@ -520,7 +520,12 @@ class ReticulumGitNode():
RNS.log(f"Created {tmp_path} for {link}", RNS.LOG_DEBUG)
bundle_path = os.path.join(tmp_path, "fetch.bundle")
- execv = ["git", "bundle", "create", "--no-progress", bundle_path] + ref_names
+ execv = ["git", "bundle", "create", "--no-progress", bundle_path]
+
+ for r in refs:
+ execv.append(r["ref"])
+ if "have" in r and r["have"]: execv.append(f"^{r['have']}")
+
result = subprocess.run(execv, cwd=repository_path, capture_output=True, check=False)
if result.returncode != 0: return self.RES_REMOTE_FAIL.to_bytes(1, "big") + result.stderr
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────